﻿package mortal.game.view.skill.command
{
    import Framework.MQ.*;
    import Message.Public.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.net.broadCast.*;
    import mortal.mvc.core.*;

    public class RuneUpdateCommand extends BroadCastCall
    {

        public function RuneUpdateCommand(param1:Object)
        {
            super(param1);
            return;
        }// end function

        override public function call(param1:MessageBlock) : void
        {
            var _loc_2:* = param1.messageBase as SRuneUpdate;
            switch(_loc_2.op)
            {
                case ERuneUpdateType._ERuneUpdateTypeAdd:
                {
                    Cache.instance.skill.addRune(_loc_2.runeId);
                    NetDispatcher.dispatchCmd(ServerCommand.RuneAdd, _loc_2.runeId);
                    break;
                }
                case ERuneUpdateType._ERuneUpdateTypeRemove:
                {
                    Cache.instance.skill.removeRune(_loc_2.runeId);
                    NetDispatcher.dispatchCmd(ServerCommand.RuneRemove, _loc_2.runeId);
                    break;
                }
                case ERuneUpdateType._ERuneUpdateTypeUpdate:
                {
                    Cache.instance.skill.runeUpgrade(_loc_2.runeId);
                    NetDispatcher.dispatchCmd(ServerCommand.RuneLevelUp, _loc_2.runeId);
                    break;
                }
                default:
                {
                    break;
                }
            }
            NetDispatcher.dispatchCmd(ServerCommand.BestSkillUpdate, null);
            return;
        }// end function

    }
}
